package at.jku.se.fastsell.db4o.transactions;

import at.jku.se.fastsell.db4o.DatabaseException;

import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

/**
 * Abstract base class for database transactions
 *
 * @param <T> - Return value of transaction
 */
public abstract class Transaction<T> {
	
//	protected ObjectContainer db = Database.getDb();
	
	
	protected DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
	protected Key key = KeyFactory.createKey("Fastsell", "Fastsell");
//	
	public abstract T run() throws DatabaseException;
//	
//	public void rollback() {
//		db.rollback();
//	}
//	
//	public void commit() {
//		db.commit();
//	}
//	
//	public void close() {
//		db.close();
//	}
//	
//	@Override
//	public String toString() {
//		return this.getClass().getName();
//	}

}
